   PROJECT(helloworld)
   FIND_PACKAGE(Qt4 REQUIRED)
   INCLUDE( ${QT_USE_FILE} )
   # assign our ui files to a variable 'UI'
   SET(UI windowbase.ui )
   # ask Qt to generate the windowbase class
   QT4_WRAP_UI(UI_H ${UI})
   # force it to be generated
   ADD_CUSTOM_TARGET(ui ALL DEPENDS ${UI_H})
   # add our generated source and our window concrete class to the build 
   SET(SRCS main.cpp window.cpp ${UI_H})
   # define a variable stating which files should be passed through the 
   # Qt 'meta object compiler'
   SET(MOC_HDRS window.h )
   # run the qt metaobject compiler on the window class header
   QT4_WRAP_CPP(MOC_SRCS ${MOC_HDRS})
   INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}   
          ${QT_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
   SET( QT_USE_QTGUI TRUE )
   # compile our sources and the autogenerated sources
   ADD_EXECUTABLE(helloworld MACOSX_BUNDLE ${SRCS} ${MOC_SRCS})
   TARGET_LINK_LIBRARIES(helloworld ${QT_QTGUI_LIBRARY} ${QT_QTCORE_LIBRARY})
   INSTALL(TARGETS helloworld RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})


